<?php

/**
 * Created by PhpStorm.
 * User: xiao
 * Date: 2017/6/14
 * Time: 下午2:46
 */
namespace app\src\platform\action;

use app\src\base\action\BaseAction;
use app\src\platform\logic\PlatformLogic;

class PlatformAction extends BaseAction
{
    /**
     * 下级平台全部
     * @param $platform_id
     * @return array
     * @return array
     */
    public function childAll($platform_id)
    {
        $result = (new PlatformLogic)->childAll($platform_id);
        if(!$result['status']) return $this->error($result['info']);
        $list = [];
        foreach ($result['info'] as $platform){
            $list[] = [
                'id' => $platform['id'],
                'group_id' => $platform['group_id'],
                'parent_id' => $platform['parent_id'],
                'name' => $platform['name'],
                'city_code' => $platform['city_code'],
                'province_code' => $platform['province_code']
            ];
        }
        return $this->success($list);
    }
}